/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package de.hwr.nbaplan.shared.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 *
 * @author flo
 */
@Entity
@Table(name = "t_user", catalog = "nbaplan", schema = "", uniqueConstraints = {
    @UniqueConstraint(columnNames = {"username"})})
@NamedQueries({
    @NamedQuery(name = "User.findAll", query = "SELECT u FROM User u"),
    @NamedQuery(name = "User.findById", query = "SELECT u FROM User u WHERE u.id = :id"),
    @NamedQuery(name = "User.findByVorname", query = "SELECT u FROM User u WHERE u.vorname = :vorname"),
    @NamedQuery(name = "User.findByNachname", query = "SELECT u FROM User u WHERE u.nachname = :nachname"),
    @NamedQuery(name = "User.findByUsername", query = "SELECT u FROM User u WHERE u.username = :username"),
    @NamedQuery(name = "User.findByPasswort", query = "SELECT u FROM User u WHERE u.passwort = :passwort"),
    @NamedQuery(name = "User.findByMail", query = "SELECT u FROM User u WHERE u.mail = :mail"),
    @NamedQuery(name = "User.findByMailnotification", query = "SELECT u FROM User u WHERE u.mailnotification = :mailnotification")})
public class User implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "vorname", nullable = false, length = 255)
    private String vorname;
    @Basic(optional = false)
    @Column(name = "nachname", nullable = false, length = 255)
    private String nachname;
    @Basic(optional = false)
    @Column(name = "username", nullable = false, length = 255)
    private String username;
    @Basic(optional = false)
    @Column(name = "passwort", nullable = false, length = 255)
    private String passwort;
    @Basic(optional = false)
    @Column(name = "mail", nullable = false, length = 255)
    private String mail;
    @Basic(optional = false)
    @Column(name = "mailnotification", nullable = false)
    private short mailnotification;

    /**
     *
     */
    public User() {
    }

    /**
     *
     * @param id
     */
    public User(Integer id) {
        this.id = id;
    }

    /**
     *
     * @param id
     * @param vorname
     * @param nachname
     * @param username
     * @param passwort
     * @param mail
     * @param mailnotification
     */
    public User(Integer id, String vorname, String nachname, String username, String passwort, String mail, short mailnotification) {
        this.id = id;
        this.vorname = vorname;
        this.nachname = nachname;
        this.username = username;
        this.passwort = passwort;
        this.mail = mail;
        this.mailnotification = mailnotification;
    }

    /**
     *
     * @return
     */
    public Integer getId() {
        return id;
    }

    /**
     *
     * @param id
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     *
     * @return
     */
    public String getVorname() {
        return vorname;
    }

    /**
     *
     * @param vorname
     */
    public void setVorname(String vorname) {
        this.vorname = vorname;
    }

    /**
     *
     * @return
     */
    public String getNachname() {
        return nachname;
    }

    /**
     *
     * @param nachname
     */
    public void setNachname(String nachname) {
        this.nachname = nachname;
    }

    /**
     *
     * @return
     */
    public String getUsername() {
        return username;
    }

    /**
     *
     * @param username
     */
    public void setUsername(String username) {
        this.username = username;
    }

    /**
     *
     * @return
     */
    public String getPasswort() {
        return passwort;
    }

    /**
     *
     * @param passwort
     */
    public void setPasswort(String passwort) {
        this.passwort = passwort;
    }

    /**
     *
     * @return
     */
    public String getMail() {
        return mail;
    }

    /**
     *
     * @param mail
     */
    public void setMail(String mail) {
        this.mail = mail;
    }

    /**
     *
     * @return
     */
    public short getMailnotification() {
        return mailnotification;
    }

    /**
     *
     * @param mailnotification
     */
    public void setMailnotification(short mailnotification) {
        this.mailnotification = mailnotification;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof User)) {
            return false;
        }
        User other = (User) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "de.hwr.nbaplan.shared.model.User[id=" + id + "]";
    }

}
